package com.t249.bdqn.renting.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.t249.bdqn.renting.entity.RetProperties;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
@Mapper
public interface RetPropertiesDao extends BaseMapper<RetProperties> {

    @Select("SELECT * FROM `ret_properties` WHERE region_id IN(SELECT id FROM `ret_region` WHERE address_Id = #{adderssId})")
    public  List<RetProperties> retPropertiesList(@Param("adderssId")Integer adderssId);

    @Select("SELECT * FROM  `ret_properties` WHERE 1=1 GROUP BY properties ORDER BY (CASE WHEN region_Id =  #{regionId} THEN 1 ELSE 2 END)")
    public List<RetProperties> xianShiList(@Param("regionId")String regionId);
}
